import request from '@/utils/request'

export function additionUser(data) {
  return request({
    url: '/user',
    method: 'post',
    data
  })
}

export function removeUser(id) {
  return request({
    url: `/user/${id}`,
    method: 'delete'
  })
}

export function updateUser(data) {
  return request({
    url: '/user',
    method: 'put',
    data
  })
}

export function searchUser(data, pageNum, pageSize) {
  return request({
    url: '/user',
    method: 'get',
    params: Object.assign({}, data, { current: pageNum, size: pageSize })
  })
}

export function getUserInfo(username) {
  return request({
    url: `/user/${username}`,
    method: 'get'
  })
}
